import { ColumnsType } from 'antd/es/table';
import dayjs from 'dayjs';
import { dataProps } from './data';

export const tableConfig: ColumnsType<dataProps> = [
  {
    title: '网站名称',
    dataIndex: 'siteName',
    ellipsis: true,
    render: (text: string) => {
      const map = new Map();
      map.set('skgm', '保定商科工贸技工学校');
      return map.get(text);
    },
    rowScope: 'row',
  },
  {
    title: '学生姓名',
    dataIndex: 'stuName',
  },
  {
    title: '手机号',
    dataIndex: 'tel',
  },
  {
    title: '中考成绩',
    dataIndex: 'score',
  },
  {
    title: '毕业院校',
    dataIndex: 'graduationSchool',
  },
  {
    title: '预报专业',
    dataIndex: 'expected_major',
  },
  {
    title: '咨询备注',
    dataIndex: 'remarks',
  },
  {
    title: '创建时间',
    dataIndex: 'create_time',
    ellipsis: true,
    sorter: (a, b, type) => {
      return dayjs(a.create_time || ' ').valueOf() - dayjs(b.create_time || ' ').valueOf();
    },
  },
  {
    title: '操作',
    dataIndex: 'actions',
    key: 'actions',
    align: 'center',
  },
];

export const FormConfig = [
  {
    id: '#1',
    name: 'identity',
    label: '您的身份',
    rules: [
      {
        required: true,
      },
    ],
    props: {},
    component: 'Radio',
    componentProps: {
      options: [
        {
          label: '学生',
          value: 0,
        },
        {
          label: '老师',
          value: 1,
        },
        {
          label: '家长',
          value: 2,
        },
        {
          label: '其他',
          value: 3,
        },
      ],
    },
  },
  {
    id: '#1_',
    name: 'siteName',
    label: '网站名称',
    rules: [
      {
        required: true,
      },
    ],
    props: {},
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '保定商科工贸技工学院',
          value: 'skgm',
        },
      ],
    },
    placeholder: '请选择网站名称!',
  },
  {
    id: '#2',
    name: 'stuName',
    label: '学生姓名',
    rules: [
      {
        required: true,
      },
    ],
    props: {},
    component: 'Input',
    componentProps: {},
    placeholder: '请输入学生姓名!',
  },
  {
    id: '#3',
    name: 'tel',
    label: '手机号',
    rules: [
      {
        required: true,
      },
    ],
    props: {},
    component: 'Input',
    componentProps: {},
    placeholder: '请输入手机号!',
  },
  {
    id: '#4',
    name: 'score',
    label: '中考分数',
    rules: [
      {
        required: true,
      },
    ],
    props: {},
    component: 'Input',
    componentProps: {},
    placeholder: '请输入中考分数!',
  },
  {
    id: '#5',
    name: 'graduationSchool',
    label: '毕业院校',
    rules: [
      {
        required: true,
      },
    ],
    props: {},
    component: 'Input',
    componentProps: {},
    placeholder: '请输入毕业院校!',
  },
  {
    id: '#6',
    name: 'expected_major',
    label: '预报专业',
    rules: [
      {
        required: true,
      },
    ],
    props: {},
    component: 'Input',
    componentProps: {},
    placeholder: '请输入预报专业!',
  },
  {
    id: '#7',
    name: 'remarks',
    label: '咨询备注',
    rules: [
      {
        required: true,
      },
    ],
    props: {},
    component: 'Input',
    componentProps: {},
    placeholder: '请输入咨询备注!',
  },
];
